using System.Net.DnsToolkit.Packet;
namespace System.Net.DnsToolkit.Serializer {
    /// <summary>
    /// Read source object into RR
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public interface IRRReader<T> {

        /// <summary>
        /// Read source object into RR throws exception if problem occurs
        /// </summary>
        /// <param name="source"></param>
        /// <returns>RR to be read</returns>
        IRR Read(T source);

        /// <summary>
        /// Read source object into RR. Do not throw exception.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="rr"></param>
        /// <returns>true if no error occured, else false.</returns>
        bool TryRead(T source, out IRR rr);

    }
}